from django.db import models


# Create your models here.

class UserInfo(models.Model):
    role_choice = (
        (1, '访客'),
        (2, '普通用户'),
        (3, '管理员'),
    )
    username = models.CharField(verbose_name='用户名', max_length=32, db_index=True)  # 增加索引，加快查询速度
    password = models.CharField(verbose_name='密码', max_length=32)
    role = models.SmallIntegerField(verbose_name='密码', choices=role_choice, default=1)
    email = models.EmailField(verbose_name='邮箱', max_length=32)
    phone = models.CharField(verbose_name='手机号', max_length=32)

    def __str__(self):
        return self.username
